import time
from selenium import webdriver
from selenium.webdriver.common.by import By

if __name__ == '__main__':
    print("hell，python！！！")
    # 打开浏览器
    reques = webdriver.Chrome()
    # 设置隐式等待时间
    reques.implicitly_wait(10)
    # 打开网址
    reques.get("https://job.xrdev.cn/admin/biaozhunxiuding/#/login")
    # 最大化窗口
    reques.maximize_window()

    # 输入用户名和密码
    reques.find_element(By.XPATH, '//*[@id="app"]/div/div[2]/div[2]/div/div/form/div[1]/div/div/input').send_keys(
        "admin")
    reques.find_element(By.XPATH, '//*[@id="app"]/div/div[2]/div[2]/div/div/form/div[2]/div/div/input').send_keys(
        "Xr123456")

    # # 代表停用
    # reques.find_elements(By.XPATH, 'body > div.el-select-dropdown.el-popper > div.el-scrollbar > div.el-select-dropdown__wrap.el-scrollbar__wrap > ul > li')[0].click()
    # /html/body/div[24]/div[1]/div[1]/ul/li[1]
    # body > div.el-select-dropdown.el-popper > div.el-scrollbar > div.el-select-dropdown__wrap.el-scrollbar__wrap > ul > li.el-select-dropdown__item.hover
    # # 代表降级
    # reques.find_elements(By.XPATH, 'body > div.el-select-dropdown.el-popper > div.el-scrollbar > div.el-select-dropdown__wrap.el-scrollbar__wrap > ul > li')[1].click()

    # 获取验证码
    node_code = input("请输入验证码:")
    # 等待3秒
    time.sleep(3)
    # 输入验证码
    reques.find_element(By.XPATH, '//*[@id="app"]/div/div[2]/div[2]/div/div/form/div[3]/div/div/input').send_keys(
        node_code)
    reques.find_element(By.XPATH, '//*[@id="app"]/div/div[2]/div[2]/div/div/form/div[5]/div/button/span').click()

    # 等待3秒
    time.sleep(3)
    # 关闭浏览器
    reques.quit()
